package com.ma.service.role;

import com.ma.dao.BaseDao;
import com.ma.dao.role.RoleDao;
import com.ma.dao.role.RoleDaoImpl;
import com.ma.dao.user.UserDao;
import com.ma.dao.user.UserDaoImpl;
import com.ma.pojo.Role;

import java.sql.Connection;
import java.util.ArrayList;
import java.util.List;

public class RoleServiceImpl implements RoleService{

    private RoleDao roleDao;
    public RoleServiceImpl(){

        roleDao = new RoleDaoImpl();

    }

    @Override
    public List<Role> getRoleList() {
        List<Role> roleList = null;
        Connection connection = null;
        try {
            connection = BaseDao.getConnection();
            roleList = roleDao.getRoleList(connection);
        } catch (Exception e) {
            e.printStackTrace();
        }finally {
            BaseDao.closeResource(connection,null,null);
        }
        return roleList;
    }
}
